<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" import="net.sf.json.*"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><s:text name="title"/></title>
<link href="<%=request.getContextPath()%>/stage/css/inside.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=request.getContextPath()%>/stage/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/stage/js/json2.js"></script>

<script type="text/JavaScript">
<!--
$(document).ready(function() {
	$("#fdiv a").css('cursor','pointer');     //统一设置查询链接为手形
    $("#fdiv a").click(function(){         //点击查询条件，改变颜色
    	if($(this).css('color')=='yellow'){
    		$(this).css('color','#ccc');
    	}else{
    		$(this).css('color','yellow');
    	}      	
    	$("#reset").css('color','#ccc'); 
    })
    init();
})
function init(){
	var colorStr='<s:property value="sDiamondBo.colour"/>';
	var purityStr='<s:property value="sDiamondBo.purity"/>';
	var cutterStr='<s:property value="sDiamondBo.cutter"/>';
	var symmetryStr='<s:property value="sDiamondBo.symmetry"/>';
	var buffingStr='<s:property value="sDiamondBo.buffing"/>';
	var fluorescenceStr='<s:property value="sDiamondBo.fluorescence"/>';
	var cerificateStr='<s:property value="sDiamondBo.cerificate"/>';
	if(colorStr!=null&&colorStr.length>=1){
		var arr=colorStr.split(", ");
		$.each($("#colo a"), function(){
			var v1=$(this);
			for(var i=0;i<arr.length;i++){
				if(v1.text()==arr[i]){
					v1.css('color','yellow');
				}
			}
		}); 
	}
	
	if(purityStr!=null&&purityStr.length>1){
		var arr=purityStr.split(", ");
		$.each($("#pure a"), function(){
			var v1=$(this);
			for(var i=0;i<arr.length;i++){
				if(v1.text()==arr[i]){
					v1.css('color','yellow');
				}
			}
		}); 
	}

	if(cutterStr!=null&&cutterStr.length>1){
		var arr=cutterStr.split(", ");
		$.each($("#cut a"), function(){
			var v1=$(this);
			for(var i=0;i<arr.length;i++){
				if(v1.text()==arr[i]){
					v1.css('color','yellow');
				}
			}
		}); 
	}
	if(symmetryStr!=null&&symmetryStr.length>1){
		var arr=symmetryStr.split(", ");
		$.each($("#sym a"), function(){
			var v1=$(this);
			for(var i=0;i<arr.length;i++){
				if(v1.text()==arr[i]){
					v1.css('color','yellow');
				}
			}
		}); 
	}
	if(buffingStr!=null&&buffingStr.length>1){
		var arr=buffingStr.split(", ");
		$.each($("#buf a"), function(){
			var v1=$(this);
			for(var i=0;i<arr.length;i++){
				if(v1.text()==arr[i]){
					v1.css('color','yellow');
				}
			}
		}); 
	}
	if(fluorescenceStr!=null&&fluorescenceStr.length>1){
		var arr=fluorescenceStr.split(", ");
		$.each($("#fluo a"), function(){
			var v1=$(this);
			for(var i=0;i<arr.length;i++){
				if(v1.text()==arr[i]){
					v1.css('color','yellow');
				}
			}
		}); 
	}
	if(cerificateStr!=null&&cerificateStr.length>1){
		var arr=cerificateStr.split(", ");
		$.each($("#cert a"), function(){
			var v1=$(this);
			for(var i=0;i<arr.length;i++){
				if(v1.text()==arr[i]){
					v1.css('color','yellow');
				}
			}
		}); 
	}
	
}
function search(){
	var server ="<%=request.getContextPath()%>/todiamond.action?1=1";
	$.each($("#buf a"), function(name, value){
    	if($(this).css('color')=='yellow'){
    		server+="&sDiamondBo.buffing="+$(this).text();
    	}
	}); 
 	$.each($("#colo a"), function(name, value){
    	if($(this).css('color')=='yellow'){
    		server+="&sDiamondBo.colour="+$(this).text();
    	}
	}); 
	$.each($("#sym a"), function(name, value){
    	if($(this).css('color')=='yellow'){
    		server+="&sDiamondBo.symmetry="+$(this).text();
    	}
	}); 
	$.each($("#pure a"), function(name, value){
    	if($(this).css('color')=='yellow'){
    		server+="&sDiamondBo.purity="+$(this).text();
    	}
	}); 
	$.each($("#fluo a"), function(name, value){
    	if($(this).css('color')=='yellow'){
    		server+="&sDiamondBo.fluorescence="+$(this).text();
    	}
	}); 
	$.each($("#cut a"), function(name, value){
    	if($(this).css('color')=='yellow'){
    		server+="&sDiamondBo.cutter="+$(this).text();
    	}
	}); 
	$.each($("#cert a"), function(name, value){
    	if($(this).css('color')=='yellow'){
    		server+="&sDiamondBo.cerificate="+$(this).text();
    	}
	});
	server  = encodeURI(server);
	server = encodeURI(server);//注意要两次 
	document.searchForm.action=server;
	document.searchForm.submit(); 
}
function toreset(){
	$("#fdiv a").css('color','#ccc');
	$("#wmin").val('');
	$("#wmax").val('');
	$("#pmin").val('');
	$("#pmax").val('');
	return false;
}
function addOrder(obj){
	var bo=JSON.parse(obj);
	alert(bo.batch);
}
//-->
</script>
</head>

<body onload="MM_preloadImages('<%=request.getContextPath()%>/stage/images/menu0_01.jpg','<%=request.getContextPath()%>/stage/images/menu0_02.jpg','<%=request.getContextPath()%>/stage/images/menu0_03.jpg','<%=request.getContextPath()%>/stage/images/menu0_04.jpg','<%=request.getContextPath()%>/stage/images/menu0_05.jpg','<%=request.getContextPath()%>/stage/images/menu0_06.jpg','<%=request.getContextPath()%>/stage/images/menu0_07.jpg')">
<div class="mainbody">
<%@ include file="head1.jsp"%>
 <div class="intermediate">
    <h1>当前位置：首页&nbsp;&gt;&nbsp;<b><FONT COLOR="#FFCC66">钻石查询</FONT></b></h1>
<%@ include file="left.jsp"%>
    <div class="right">
         <h4><img src="<%=request.getContextPath()%>/stage/images/zscx/zscx_03.jpg" width="158" height="15" /></h4>
		 <div class="jgkz_bt">
		    <ul>
		       <li><img src="<%=request.getContextPath()%>/stage/images/zscx/zscx_07.jpg" width="87" height="29" /></li>
			   <li><img src="<%=request.getContextPath()%>/stage/images/zscx/zscx_14.jpg" width="35" height="29" /></li>
			   <li><img src="<%=request.getContextPath()%>/stage/images/zscx/zscx_09.jpg" width="87" height="29" /></li>
			   <li><img src="<%=request.getContextPath()%>/stage/images/zscx/zscx_14.jpg" width="35" height="29" /></li>
			   <li><img src="<%=request.getContextPath()%>/stage/images/zscx/zscx_11.jpg" width="87" height="29" /></li>
		    </ul>
	  </div>
		 <div class="jgkz" id="fdiv">
		 <form name="searchForm" method="post">
		<table width="98%" height="165" align="center" cellpadding="0" cellspacing="10">
		   
  <tr>
    <td width="50%" height="11%" valign="baseline">重量：
      <label>
      <input maxlength="4" id="wmin" value='<s:property value="sDiamondBo.minWeight"/>' name="sDiamondBo.minWeight" type="text" class="kuang1" onKeypress="return (/[\d.]/.test(String.fromCharCode(event.keyCode)))"/>
      </label>-<label>
      <input maxlength="4" id="wmax" value='<s:property value="sDiamondBo.maxWeight"/>' name="sDiamondBo.maxWeight" type="text" class="kuang1" onKeypress="return (/[\d.]/.test(String.fromCharCode(event.keyCode)))"/>
      克拉
      </label></td>
    </tr>
  <tr>
    <td height="11%">颜色：<span class="zise1" id="colo"><a>D</a>|<a>E</a>|<a>F</a>|<a>G</a>|<a>H</a>|<a>I</a>|<a>J</a>|<a>K</a></span></td>
    <td>抛光：<span class="zise1" id="buf"><a>Ideal</a>|<a>EX</a>|<a>VG</a>|<a>GD</a>|<a>Fair</a></span></td>
    </tr>
  <tr>
    <td height="11%">净度：<span class="zise1" id="pure"><a>FL</a>|<a>IF</a>|<a>VVS1</a>|<a>VVS2</a>|<a>VS1</a>|<a>VS2</a></span></td>
    <td>荧光：<span class="zise1" id="fluo"><a>Ideal</a>|<a>EX</a>|<a>VG</a>|<a>GD</a>|<a>Fair</a></span></td>
    </tr>
  <tr>
    <td height="11%">切工：<span class="zise1" id="cut"><a>Ideal</a>|<a>EX</a>|<a>VG</a>|<a>GD</a>|<a>Fair</a></span></td>
    <td>对称：<span class="zise1" id="sym"><a>Ideal</a>|<a>EX</a>|<a>VG</a>|<a>GD</a>|<a>Fair</a></span></td>
    </tr>
  <tr>
    <td>证书：<span class="zise1" id="cert"><a>GIA</a>|<a>HRD</a>|<a>IGI</a>|<a>国检</a></span></td>
    <td><label>
      <input type="image" name="imageField2" src="<%=request.getContextPath()%>/stage/images/zscx/zscx_21.jpg" onclick="search()"/>
    </label>
      <label>
      <input type="image" onclick="return toreset()" id="reset" name="imageField3" src="<%=request.getContextPath()%>/stage/images/jgkz/jgkz_13.jpg" />
      </label></td>
    </tr>
</table>
    </form>
</div>
      <div class="jgkz">
	       <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
             <tr>
               <td height="30" align="center" class="xian_01">货 号 </td>
               <td height="30" align="center" class="xian_01">证 书 </td>
               <td height="30" align="center" class="xian_01">钻 重</td>
               <td height="30" align="center" class="xian_01">形 状</td>
               <td height="30" align="center" class="xian_01">净 度</td>
               <td height="30" align="center" class="xian_01">颜 色</td>
               <td height="30" align="center" class="xian_01">抛 光 </td>
               <td height="30" align="center" class="xian_01"> 对 称 </td>
               <td height="30" align="center" class="xian_01">切 工</td>
               <td align="center" class="xian_01">实 价</td>
               <td align="center" class="xian_01_1"> 选 中</td>
             </tr>
             <s:iterator value="dataList" id="bo" status="u">
				<s:if test="#u.index%2!=0"><tr bgcolor="#2e2e2e"></s:if>
				<s:else><tr></s:else>
               <td width="14%" height="30" align="center" class="xian_02"><a href="<%=request.getContextPath()%>/todiadetail.action?diamondid=<s:property value="diamondId"/>"><s:property value="batch"/></a></td>
               <td width="8%" height="30" align="center" class="xian_02"><a href="<%=request.getContextPath()%>/todiadetail.action?diamondid=<s:property value="diamondId"/>"><s:property value="lab"/></a></td>
               <td width="8%" height="30" align="center" class="xian_02"><a href="<%=request.getContextPath()%>/todiadetail.action?diamondid=<s:property value="diamondId"/>"><s:property value="weight"/></a></td>
               <td width="8%" height="30" align="center" class="xian_02"><a href="<%=request.getContextPath()%>/todiadetail.action?diamondid=<s:property value="diamondId"/>"><s:property value="shape"/></a></td>
               <td width="9%" height="30" align="center" class="xian_02"><a href="<%=request.getContextPath()%>/todiadetail.action?diamondid=<s:property value="diamondId"/>"><s:property value="clarity"/></a></td>
               <td width="8%" height="30" align="center" class="xian_02"><a href="<%=request.getContextPath()%>/todiadetail.action?diamondid=<s:property value="diamondId"/>"><s:property value="color"/></a></td>
               <td width="9%" height="30" align="center" class="xian_02"><a href="<%=request.getContextPath()%>/todiadetail.action?diamondid=<s:property value="diamondId"/>"><s:property value="polish"/></a></td>
               <td width="9%" height="30" align="center" class="xian_02"><a href="<%=request.getContextPath()%>/todiadetail.action?diamondid=<s:property value="diamondId"/>"><s:property value="symmetry"/></a></td>
               <td width="8%" height="30" align="center" class="xian_02"><a href="<%=request.getContextPath()%>/todiadetail.action?diamondid=<s:property value="diamondId"/>"><s:property value="finalCut"/></a></td>
               <td width="11%" align="center" class="xian_02"><a href="<%=request.getContextPath()%>/todiadetail.action?diamondid=<s:property value="diamondId"/>"><s:property value="buyPrice"/></a></td>
               <td width="6%" align="center"><label>
               <input name="itemcheck" type="checkbox" class="fxk" onclick="return addOrder('<s:property value="%{@net.sf.json.JSONObject@fromObject(#bo).toString()}"/>');"/>
               </label></td>
             </tr>
             </s:iterator>
           </table>
	    </div>
  		 <div class="jgkz_bt" style=" margin:5px auto 0 auto">
           <ul style="height:21px;">
			 <li><jsp:include page="page.jsp"/></li>
			 <li style="float:right"><input type="image" onclick="return addOrder();" src="<%=request.getContextPath()%>/stage/images/zscx/zscx_29.jpg" /></li>
           </ul>
        </div>
    </div>
 </div>
 <%@ include file="foot.jsp"%>
</div>
</body>
</html>
